<!-- 通用组件：穿梭框 -->
<template>
    <div :id="id">
        <el-transfer v-model="value" :data="data"></el-transfer>
    </div>
</template>

<script>
    import register from '@/js/main/register.js';

    export default {
        props: {
            element: {
                type: Object
            },
            id: {
                type: String
            }
        },
        data() {
            const generateData = _ => {
                const data = [];
                for (let i = 1; i <= 15; i++) {
                    data.push({
                        key: i,
                        label: `备选项 ${i}`,
                        disabled: i % 4 === 0
                    });
                }
                return data;
            };
            return {
                data: generateData(),
                value: [1, 4]
            }
        },
        created() {
            register.addComponent(this);
        },
        destroyed() {
            register.removeComponent(this);
        }
    }
</script>